package cn.tedu._05weibo.pojo.dto;

import com.sun.istack.internal.NotNull;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Pattern;

/**
 * 注册功能DTO类
 */
@Data
public class UserRegDTO {
    /*
        1.NotNull注解:不允许为空值null,message参数为自定义提示消息
                     [ex.getFieldError().getDefaultMessage()];
        2.NotEmpty注解:不允许为空字符串,不允许为null值;
        3.NotBlank注解:不允许为空白串,空字符串,null值;
        4.Size注解:限制字符串类型的长度;
        5.Pattern注解：正则表达式校验,适用于相对复杂的数据合法性要求;
     */
    @Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,7}|[a-zA-Z]{1,14}$", message = "用户名不能超过7个汉字或14个字符")
    @ApiModelProperty(value = "昵称", required = true, example = "Tony")
    private String nickname;
    @ApiModelProperty(value = "密码", required = true, example = "123456")
    private String password;

    @ApiModelProperty(value = "用户名", required = true, example = "tony")
    private String username;
}
